export default {
  // Global page headers: https://go.nuxtjs.dev/config-head
  mode: 'universal',
  head: {
    title: 'Gene Universal',
    htmlAttrs: {
      lang: 'en'
    },
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' },
      { name: 'format-detection', content: 'telephone=no' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ],
    script: [
      { src: "/goole.js" },
      { src: "https://www.googletagmanager.com/gtag/js?id=AW-518551825" }
    ]
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
    '~/assets/css/fonts/webFonts/Montserrat/Montserrat.css',
    '~/assets/css/base.css'
  ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    {
      src: '~/plugins/axios'
    },
    {
      src: '~/plugins/lib-flexible.js', ssr: false
    }
  ],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,
  styleResources: {
    less: '@/styles/variables.less'
  },
  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
    // https://go.nuxtjs.dev/eslint
    '@nuxtjs/eslint-module'
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/style-resources',
    '@nuxtjs/axios'
  ],

  // Axios module configuration: https://go.nuxtjs.dev/config-axios
  axios: {
    // Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
    baseURL: '/'
  },

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    optimization: {
      splitChunks: {
        // 生成 chunk 的最小体积（以 bytes 为单位）
        minSize: 30000,
        // https://webpack.docschina.org/plugins/split-chunks-plugin/
        maxSize: 102400
      }
    },
    postcss:[
      require('postcss-pxtorem')({
        rootValue: 192, // 指定转换倍率，我现在设置这个表示1rem=37.5px;
        propList: ['*'], // 属性列表，表示你要把哪些css属性的px转换成rem，这个*表示所有
        mediaQuery: false, // 是否允许使用媒体查询，false媒体查询的代码可用，true不可用
        exclude: 'ignore',
        replace: true, // 替换包含rem的规则，而不是添加回退
        minPixelValue: 10, // 需要转换的最小值，一般1px像素不转换，以上才转换
        unitPrecision: 2 // 转换成rem单位的小数点后的保留位数
      })
    ]
  },
  router: {
    base: process.env.NODE_ENV === 'production' ? '/' : '',
    resourceHints: false,
    prefetchLinks: false // 解决首屏加载全部js
  }
}
